package com.integrance.budgetapp.domain;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "PORTFOLIO")
public class Portfolio {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "portfolio_id", nullable = false, unique = true)
	private Long id;

	@Column(name = "label", length = 30, nullable = false)
	private String label;

	@Column(name = "create_date", nullable = false)
	private Date createDate;
	
	@Column(name = "portfolio_timestamp")
	private Date timestamp;

	@ManyToOne
	@JoinColumn(name = "profile_id", nullable = false)
	private Profile profile;
	
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "portfolio")
	private Set<Budget> budgets;
	
	
    public Portfolio() {
        
    }
    
	public Portfolio(String label, Date createDate, Profile profile) {
		this.label = label;
		this.createDate = createDate;
		this.profile = profile;
	}

	public Long getId() {
		return id;
	}

	private void setId(Long id) {
		this.id = id;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public Date getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}
	
	public Date getCreateDate() {
		return createDate;
	}
	
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Profile getProfile() {
		return profile;
	}
	
	public void setProfile(Profile profile) {
		this.profile = profile;
	}
	
	public Set<Budget> getBudgets() {
		return budgets;
	}
		
	public void setBudgets(Set<Budget> budgets) {
		this.budgets = budgets;
	}
}
